cmake_minimum_required(VERSION 3.1)

set(project_name tootIoTServer)

project(${project_name})

set(CMAKE_CXX_STANDARD 17)
SET(CMAKE_BUILD_TYPE "Debug")
SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g2 -ggdb")

add_library(${project_name}-lib
        src/App.cpp
        src/AppComponent.hpp
        src/IoTServerConfig.hpp
        src/dto/type0_DTO.hpp
        src/dto/lastestData_DTO.hpp
        src/dto/lastTimeData_DTO.hpp
        src/controller/SController.hpp
        src/DataControl.hpp
        src/DataControl.cpp
        src/Timer.hpp
        src/Timer.cpp
        src/dto/type2_DTO.hpp
        src/databaseControl.cpp
        src/databaseControl.hpp
        src/DynamicStruct.hpp
        src/DynamicStruct.cpp
        src/Time.hpp
        src/systemInfo.cpp
        src/systemInfo.hpp
)

## link libs

find_package(oatpp 1.3.0 REQUIRED)
find_package(fmt REQUIRED)

target_link_libraries(${project_name}-lib
        PUBLIC oatpp::oatpp
        PUBLIC fmt::fmt
        PUBLIC /mariadb/libmariadbcpp.so
)

target_include_directories(${project_name}-lib PUBLIC src)

## add executables

add_executable(${project_name}-exe
        src/App.cpp
)
target_link_libraries(${project_name}-exe ${project_name}-lib)
add_dependencies(${project_name}-exe ${project_name}-lib)